<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->

<title>del_curterm</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_000_274">&nbsp;</a>NAME</h4><blockquote>
del_curterm, restartterm, set_curterm, setupterm
- interfaces to the <b>terminfo</b> database
</blockquote><h4><a name = "tag_000_000_275">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="term.h.html">term.h</a>&gt;

int del_curterm(TERMINAL *<i>oterm</i>);

int restartterm(char *<i>term</i>, int <i>fildes</i>, int *<i>errret</i>);

TERMINAL *set_curterm(TERMINAL *<i>nterm</i>);

int setupterm(char *<i>term</i>, int <i>fildes</i>, int *<i>errret</i>);

</code>
</pre>
</blockquote><h4><a name = "tag_000_000_276">&nbsp;</a>DESCRIPTION</h4><blockquote>
These functions retrieve information from the <b>terminfo</b> database.
<p>
To gain access to the <b>terminfo</b> database,
<i><a href="setupterm.html">setupterm()</a></i>
must be called first.  It is automatically called by
<i><a href="initscr.html">initscr()</a></i>
and
<i><a href="newterm.html">newterm()</a></i>.
The
<i><a href="setupterm.html">setupterm()</a></i>
function initialises the other functions to use the <b>terminfo</b> record for
a specified terminal (which depends on whether
<i><a href="use_env.html">use_env()</a></i>
was called).  It sets the
<i>cur_term</i>
external variable to a <b>TERMINAL</b> structure that contains the record from
the <b>terminfo</b> database for the specified terminal.
<p>
The terminal type is the character string <i>term;</i> if <i>term</i> is a null
pointer, the environment variable TERM is used.  If TERM is not set or if its
value is an empty string, then "unknown" is used as the terminal type.
The application must set fildes to a file
descriptor, open for output, to the terminal device, before calling
<i><a href="setupterm.html">setupterm()</a></i>.
If errret</i> is not null, the integer it points to is set to one of the
following values to report the function outcome:
<dl compact>

<dt>-1<dd>The <b>terminfo</b> database was not found (function fails).

<dt>0<dd>The entry for the terminal was not found in <b>terminfo</b> (function fails).

<dt>1<dd>Success.

</dl>
<p>
If
<i><a href="setupterm.html">setupterm()</a></i>
detects an error and <i>errret</i> is a null pointer,
<i><a href="setupterm.html">setupterm()</a></i>
writes a diagnostic message and exits.
<p>
A simple call to
<i><a href="setupterm.html">setupterm()</a></i>
that uses all the defaults and sends the output to <i>stdout</i> is:
<pre>
<code>
setupterm((char *)0, fileno(stdout), (int *)0);
</code>
</pre>
The
<i><a href="set_curterm.html">set_curterm()</a></i>
function sets the variable <i>cur_term</i> to <i>nterm</i>, and makes all of the
<b>terminfo</b> boolean, numeric, and string variables use the values from
<i>nterm.</i>
<p>
The
<i>del_curterm()</i>
function frees the space pointed to by <i>oterm</i> and makes it available for
further use.  If <i>oterm</i> is the same as <i>cur_term</i>, references to any
of the <b>terminfo</b> boolean, numeric, and string variables thereafter may
refer to invalid memory locations until
<i><a href="setupterm.html">setupterm()</a></i>
is called again.
<p>
The
<i><a href="restartterm.html">restartterm()</a></i>
function assumes a previous call to
<i><a href="setupterm.html">setupterm()</a></i>
(perhaps from
<i><a href="initscr.html">initscr()</a></i>
or
<i><a href="newterm.html">newterm()</a></i>).
It lets the application specify a different terminal type in <i>term</i>
and updates the information returned by
<i><a href="baudrate.html">baudrate()</a></i>
based on <i>fildes</i>, but does not destroy other information created by
<i><a href="initscr.html">initscr()</a></i>,
<i><a href="newterm.html">newterm()</a></i>
or
<i><a href="setupterm.html">setupterm()</a></i>.
</blockquote><h4><a name = "tag_000_000_277">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion,
<i><a href="set_curterm.html">set_curterm()</a></i>
returns the previous value of <i>cur_term</i>.  Otherwise, it returns a null
pointer.
<p>
Upon successful completion, the other functions return OK.  Otherwise, they
return ERR.
</blockquote><h4><a name = "tag_000_000_278">&nbsp;</a>ERRORS</h4><blockquote>
No errors are defined.
</blockquote><h4><a name = "tag_000_000_279">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
An application would call
<i><a href="setupterm.html">setupterm()</a></i>
if it required access to the <b>terminfo</b> database but did not otherwise
need to use Curses.
</blockquote><h4><a name = "tag_000_000_280">&nbsp;</a>SEE ALSO</h4><blockquote>
<xref href=selecterm></xref>
<i><a href="baudrate.html">baudrate()</a></i>,
<i><a href="erasechar.html">erasechar()</a></i>,
<i><a href="has_ic.html">has_ic()</a></i>,
<i><a href="longname.html">longname()</a></i>,
<i><a href="../xsh/putc.html">putc()</a></i>,
<i><a href="termattrs.html">termattrs()</a></i>,
<i><a href="termname.html">termname()</a></i>,
<i><a href="tgetent.html">tgetent()</a></i>,
<i><a href="tigetflag.html">tigetflag()</a></i>,
<i><a href="use_env.html">use_env()</a></i>,
<i><a href="term.h.html">&lt;term.h&gt;</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
